// LoginController.java
package com.nep.NEPG.controller;

import com.nep.NEPG.model.SystemUser;
import com.nep.NEPG.repository.UserRepository;
import com.nep.NEPG.service.AuthService;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

import java.io.IOException;

public class LoginController {
     @FXML private TextField usernameField;
     @FXML private PasswordField passwordField;
     private final UserRepository userRepository;

     public LoginController() {
          this.userRepository = new UserRepository();
     }

     @FXML
     private void handleLogin(ActionEvent event) {
          SystemUser user = userRepository.findByUsername(usernameField.getText());
          // ...其余登录逻辑保持不变
     }

     private void loadMainView(ActionEvent event) {
          AuthService authService = new AuthService(userRepository);
          // ...其余代码保持不变
     }
}